var DB = function() {
	this.init = function() {
		// localStorage.clear();
		this.addScore({name:'AAA', score:'235', time:'2938'});
		this.addScore({name:'BBB', score:'764', time:'54'});
		this.addScore({name:'CGD', score:'97', time:'8'});
	};

	this.addScore = function(data) {
		var scores = this.getScores();
		scores.push({'name': data.name, 'score': data.score, 'time': data.time });
		localStorage.scores = JSON.stringify(scores);
	};

	this.getScores = function() {
		var data = [];
		var json = localStorage.scores;
		if (json != undefined)
			data = JSON.parse(json);

		return data;
	}
};
var db = new DB();